Developer Documentation

QuickTime 4 API Documentation

QuickTime 4 Reference

| Previous | Chapter Contents | Chapter Top | Next |

Adding Samples to Media Structures

SetMediaDefaultDataRefIndex

The SetMediaDefaultDataRefIndex function allows you to specify which of a media's data references is to be accessed during an editing session.

pascal OSErr SetMediaDefaultDataRefIndex (
                     Media theMedia,
                     short index);
theMedia
Specifies the media for this operation. Your application obtains this media identifier from such toolbox functions as NewTrackMedia and GetTrackMedia .

index
Specifies the data reference to access. Values of the index parameter range from 1 to the number of data references in the media. You can determine the number of data references by calling the GetMediaDataRefCount function. Once set, the default data reference index persists. Set this parameter to 0 to revert to the media's default data reference.

Description

Before QuickTime 2.0, the Movie Toolbox did not allow the creation of tracks that have data in several files. Therefore, there was not a mechanism for controlling which data reference is affected by a media editing session. The SetMediaDefaultDataRefIndex function allows you to specify the index of the data reference to be edited. After calling this function, you can start editing that data reference by calling the BeginMediaEdits function.

RESULT CODES

invalidMedia -2008 The media is corrupted or invalid
badDataRefIndex -2050 Data reference index value is invalid

SetMediaPreferredChunkSize

The SetMediaPreferredChunkSize function allows you to specify a maximum chunk size for a media.

pascal OSErr SetMediaPreferredChunkSize (
                     Media theMedia,
                     long maxChunkSize);
theMedia
Specifies the media for this operation. Your application obtains this media identifier from such toolbox functions as NewTrackMedia and GetTrackMedia .

maxChunkSize
Specifies the maximum chunk size, in bytes.

DISCUSSION

The term chunk refers to the collection of sample data that is added to a movie when you call the AddMediaSample function. When QuickTime loads a movie for playback, it loads the data a chunk at a time. Consequently, both the size and number of chunks in a movie can affect playback performance. The toolbox tries to optimize playback performance by consolidating adjacent sample references into a single chunk (up to the limit you prescribe with this function).

RESULT CODES

noMediaHandler -2006 Media has no media handler
invalidMedia -2008 The media is corrupted or invalid

GetMediaPreferredChunkSize

The GetMediaPreferredChunkSize function allows you to retrieve the maximum chunk size for a media.

pascal OSErr GetMediaPreferredChunkSize (
                     Media theMedia,
                     long *maxChunkSize);
theMedia
Specifies the media for this operation. Your application obtains this media identifier from such toolbox functions as NewTrackMedia and GetTrackMedia .

maxChunkSize
Specifies a field to receive the maximum chunk size, in bytes.

RESULT CODES

noMediaHandler -2006 Media has no media handler
invalidMedia -2008 The media is corrupted or invalid

© 1999 Apple Computer, Inc.

| Previous | Chapter Contents | Chapter Top | Next |